<?php

class Logout extends Controller
{
		//Constructor
		function Logout()
		{
				parent::Controller();
		}
		//Default function
		function index()
		{
				//Load the user model
				$this->load->model('usermodel');
				//logout the user. set in DB
				$this->usermodel->logout($this->session->userdata('userId'));
				//Clear the session
				$logout = array('userId' => '', 'sessId' => '');
				$this->session->unset_userdata($logout);
				//Go to the login page
				redirect('home');
		}
}